package io.SerializableDemo;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;

public class ReadObject {
    public static void main(String[] args) throws IOException, ClassNotFoundException {

        ObjectInputStream objectInputStream = new ObjectInputStream(new FileInputStream("object.txt"));
        Person person = (Person)objectInputStream.readObject();
        System.out.println(person.getName() + " " + person.getAge());
        objectInputStream.close();
    }
}
